package com.houseliker.model;

import android.os.Parcel;
import android.os.Parcelable;

import org.json.JSONObject;

import java.io.Serializable;

/**
 * Created by sunrx on 2015/12/12.
 */
public class Result<T> implements Parcelable, Serializable {
    private static final long serialVersionUID = -2323345707004769165L;
    public String result;
    public int errno;
    public String msg;
    public T data;
    public JSONObject errorMsgs;

    protected Result(Parcel in) {
        result = in.readString();
        errno = in.readInt();
        msg = in.readString();
    }

    public static final Creator<Result> CREATOR = new Creator<Result>() {
        @Override
        public Result createFromParcel(Parcel in) {
            return new Result(in);
        }

        @Override
        public Result[] newArray(int size) {
            return new Result[size];
        }
    };

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(result);
        dest.writeInt(errno);
        dest.writeString(msg);
    }
}
